package com.deryun.tyl.dao.impl;

import java.util.List;

import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;

import com.deryun.tyl.bean.Policy;
import com.deryun.tyl.bean.mapper.PolicyMapper;

public class PolicyDaoImpl extends SqlSessionDaoSupport {
	
	@Autowired
	private PolicyMapper policyMapper;
	
	//1添加政策法规
	public int addPolicy(Policy policy){
		return policyMapper.addPolicy(policy);
	}
	
	//2获取所有政策法规
	public List<Policy> getAllPolicy(){
		return policyMapper.getAllPolicy();
	}
	
	//3获取本人发布的政策法规
	public List<Policy> getUserPolicy(String publishUserId){
		return policyMapper.getUserPolicy(publishUserId);
	}
	
	//删除一个政策法规
	public int deletePolicy(int id){
		return policyMapper.deletePolicy(id);
	}
	
	//获取6个最新政策法规
	public List<Policy> getNewPolicys(){
		return policyMapper.getNewPolicys();
	}
	
	
	//7修改政策法规
	public int modifyPolicy(Policy policy){
		return policyMapper.modifyPolicy(policy);
	}
	
	//8获取一个详细的政策法规
	public Policy getPolicyById(int id){
		return policyMapper.getPolicyById(id);
	}
	
	//9审批政策法规
	public int setResult(Policy policy){
		return policyMapper.setResult(policy);
	}
}
